package vn.com.fsoft.model.entities;

import javax.persistence.*;


@Entity
@Table(name="ADDRESS")
public class Address implements java.io.Serializable{

	/**
	 * 
	 */
	private static final long serialVersionUID = -3158622303880505306L;
	private int addressId;
	private String postCode;
	private Town townAddress;
	private String street;
	private String addressDetail;
	
	public Address(){
		super();
	}	
	
	public Address(int addressId, String postCode, Town townAddress,
			String street, String addressDetail, String countryName,
			String countyName, String townName) {
		super();
		this.addressId = addressId;
		this.postCode = postCode;
		this.townAddress = townAddress;
		this.street = street;
		this.addressDetail = addressDetail;		
	}
	
	@Id
	@GeneratedValue(strategy=GenerationType.IDENTITY)
	@Column(name="ADDRESS_ID",nullable=false,unique=true)
	public int getAddressId() {
		return addressId;
	}
	public void setAddressId(int addressId) {
		this.addressId = addressId;
	}
	@Column(name="POSTCODE",length=20)
	public String getPostCode() {
		return postCode;
	}
	public void setPostCode(String postCode) {
		this.postCode = postCode;
	}
	@ManyToOne(fetch = FetchType.LAZY)
	@JoinColumn(name = "TOWN_ID", nullable = false)
	public Town getTownAddress() {
		return townAddress;
	}
	public void setTownAddress(Town town) {
		this.townAddress = town;
	}
	@Column(name="STREET",length=50)
	public String getStreet() {
		return street;
	}
	public void setStreet(String street) {
		this.street = street;
	}
	@Column(name="ADDRESS_DETAIL",length=200)
	public String getAddressDetail() {
		return addressDetail;
	}
	public void setAddressDetail(String addressDetail) {
		this.addressDetail = addressDetail;
	}
	
}
